<?php
/**
 * 功能: 正整数验证
 * User: 文丹
 * Date: 2018/5/17 0017
 * Time: 10:42
 */

namespace app\validate;
use app\validate\BaseValidate;

class PostiveInt extends BaseValidate{
    protected $rule = [
        'limit_man'=>'require|isPositiveInteger',
        'money'=>'require|isPositiveInteger'
    ];
    protected $message  =   [
        'limit_man.require' => '查看人数不能为空',
        'limit_man.isPositiveInteger'     => '查看人数必须为正整数',
        'money.require' => '查看费用不能为空！',
        'money.isPositiveInteger'     => '查看费用为正整数',

    ];
    /**
     * 验证值是否为正整数；
     * @param $value
     * @param string $rule
     * @param string $data
     * @param string $field :
     */
    protected function isPositiveInteger($value,$rule='',$data='',$field='',$message=''){
        if(is_numeric($value) && is_int($value+0) && ($value+0)>0 ){

        }else{
            return $field.$message;
        }

    }

}